home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Periodicals / develop / develop 4 code / C++ Driver / iacDriver / DriverGlue.incl.a < prev    next >
Encoding:
Text File  |  1990-04-14  |  3.9 KB  |  105 lines  |  [TEXT/MPS ]

  1. *
  2. *    Apple Macintosh Developer Technical Support
  3. *
  4. *    DriverGlue
  5. *
  6. *    DriverGlue.inc1.a    -    Assembler Source
  7. *
  8. *    Copyright © 1989 Apple Computer, Inc.
  9. *    All rights reserved.
  10. *
  11. *    Versions:    
  12. *        1.00            08/88
  13. *        1.01            11/88
  14. *        1.02            04/89    MPW 3.1
  15. *
  16. *    Components:
  17. *        DriverGlue.a        April 1, 1989
  18. *        DriverGlue.inc1.a        April 1, 1989
  19.  
  20. * ----------- DEBUGGING INFORMATION -------------
  21. * This is used as a global switch to turn off the generation of debugging information.
  22. * The MACRO "DbgInfo" will generate this debugging information if set to 1.
  23.  
  24. DebuggerInfo    EQU    1
  25.  
  26. * ------------- GENERATE DEBUGGER SYMBOL INFORMATION -------------
  27. * This Macro will generate information for the debugger to read and display
  28. * as its module name.  This aids in debugging Asm code while looking at it
  29. * in the debugger.  This macro can only work if called at the end of stack
  30. * frame.  The appearance of the Macro statement in the source code must occur
  31. * immediately after the final "JMP   (A0)" or "RTS" instruction following the UNLINK.
  32. * Spaces may be included in the name, but no quotes are allowed.
  33.  
  34. *  {Form #1}    DbgInfo        ModName
  35. *  {Form #2}    DbgInfo.New    Really Long Module Name For MacsBug 6.0
  36.  
  37. * There are now two naming conventions used in MacsBug, Form #1 is the older MacsBug,
  38. * or TMON, and Form #2 is the newer MacsBug 6.0.  The older method would only
  39. * allow for a fixed length of eight characters.  If a shorter name is passed to
  40. * this Macro, it will extend the length to 8 chars with trailing spaces.
  41. * MacsBug 6.0 will now allow for a variable length C type string. This Macro will
  42. * create the proper DC statements and takes into account word alignment issues.
  43.  
  44.  
  45.         MACRO
  46.         DbgInfo.&Opt     &ModName#    ; the name to be used in the Debugger
  47.         PRINT        Push,NoMDir     ; Only list generated code
  48.         LCLC        &DbgName#    ; name to generate for MacsBug
  49.         LCLC        &DbgTemp    ; temporary name variable
  50.         LCLC        &New        ; variable used to test old vs. new
  51.         LCLC        &S        ; variable used to save PRINT state
  52.  
  53.  IF DebuggerInfo THEN                        ; do we want debugging info?
  54.     IF &ModName# ≠ '' THEN                    ; did we get a module name?
  55.     &New: SETC &UpCase(&Opt)                ; make option all upper case
  56.     IF (&New = 'NEW') THEN                    ; do we want new style?
  57.  
  58. .* Create the new MacsBug naming convention
  59. * -----------------------------------------------
  60.        &DbgTemp: SETC    &ModName#            ; generate new type symbols
  61.        IF &Len(&ModName#) < 32 THEN                ; if module name < 32 chars
  62.         IF &Len(&ModName#) // 2 = 0 THEN         ; add space if even so that...
  63.            &DbgTemp: SETC &Concat(&ModName#,' ')     ; string length plus length byte...
  64.         ENDIF                        ; will align to word boundary
  65.        &DbgName#: SETC &Concat(&Chr($80 + &Len(&ModName#)), &DbgTemp)
  66.        ELSE                            ; Length > 32 characters
  67.         IF &Len(&ModName#) // 2 = 1 THEN         ; add space if length is odd
  68.            &DbgTemp: SETC &Concat(&ModName#,' ')
  69.         ENDIF
  70.        &DbgName#: SETC &Concat(&Chr($80), &Chr(&Len(&ModName#)), &DbgTemp)
  71.        ENDIF
  72.     ELSE                            ; make it the older style
  73.  
  74. .* Create the older MacsBug naming convention
  75. * -----------------------------------------------
  76.        IF &Len(&ModName#) < 8 THEN                ; if module name < 8 chars
  77.         &DbgName#: SETC &Concat(&ModName#,'       ')    ; add at least 7 spaces
  78.         &DbgName#: SETC &Concat(&Chr($80 + &ORD(&SubStr(&DbgName#,1,1))), &SubStr(&DbgName#,2,7))
  79.        ELSE                            ; there are at least 8 chars
  80.         &DbgName#: SETC &Concat(&Chr($80 + &ORD(&SubStr(&ModName#,1,1))), &SubStr(&ModName#,2,7))
  81.        ENDIF
  82.     ENDIF
  83.  
  84. .* Create the DC.B with the debugger name, and include the NULs if new MacsBug option
  85. * -----------------------------------------------
  86.     &S: SETC &Setting('STRING')        ; preserve STRING status
  87.     IF &S ≠ 'ASIS' THEN            ; only change it if not already ASIS
  88.        STRING    ASIS
  89.        DC.B      '&DbgName#'
  90.        IF (&New = 'NEW') THEN
  91.         DC.W        0        ; fake literal size for new MacsBug
  92.        ENDIF
  93.        STRING    &S
  94.     ELSE
  95.        DC.B      '&DbgName#'
  96.        IF (&New = 'NEW') THEN
  97.         DC.W        0        ; fake literal size for new MacsBug
  98.        ENDIF
  99.     ENDIF
  100.    ENDIF
  101.  ENDIF
  102.  
  103.         PRINT    Pop             ; restore original print status
  104.         ENDM
  105.